package cn.tedu.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
//把自定义的拦截器,配置在容器中
@Configuration
public class MyConfig implements WebMvcConfigurer {
    @Autowired //spring提供的注解,用来完成di--自动装配
    private MyInterceptor my;

    //重写接口里的方法,添加自定义拦截器
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(my);
    }
}